<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">日程安排登记表</h3>
            </div>

            <!-- BASIC FORM ELEMENTS -->
            <!--===================================================-->
            <form id="form_schedule_input" class="panel-body form-horizontal form-padding">
                <input type="hidden" name="keyId" id="keyId" value="${schedule.id}" />
                <div class="form-group">
                    <label class="col-md-2 control-label">日程类型<i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="dictItem" name="dictItem" class="form-control" value="${schedule.scheDictItem.name}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">主题<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="subject" name="subject" class="form-control" placeholder="请输入主题" value="${schedule.subject}" disabled>
                    </div>
                </div>

                <div class="form-group div-Hidden">
                    <label class="col-md-2 control-label">开始日期<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group date">
                            <input type="text" class="form-control" id="datStart" name="datStart" disabled
                                   value=<fmt:formatDate pattern="yyyy-MM-dd" value="${schedule.datStart}" /> >
                            <span class="input-group-addon"><i class="ti-calendar"></i></span>
                        </div>
                    </div>
                    <label class="col-md-2 control-label">开始时间<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group clockpicker">
                            <input type="text" class="form-control" id="timStart" name="timStart" disabled
                                   value=<fmt:formatDate pattern="HH:mm" value="${schedule.timStart}" /> >
                            <span class="input-group-addon"><i class="ti-alarm-clock"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group div-Hidden">
                    <label class="col-md-2 control-label">结束日期<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group date">
                            <input type="text" class="form-control" id="datEnd" name="datEnd" disabled
                                   value=<fmt:formatDate pattern="yyyy-MM-dd" value="${schedule.datEnd}" /> >
                            <span class="input-group-addon"><i class="ti-calendar"></i></span>
                        </div>
                    </div>
                    <label class="col-md-2 control-label">结束时间<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group clockpicker">
                            <input type="text" class="form-control" id="timEnd" name="timEnd" disabled
                                   value=<fmt:formatDate pattern="HH:mm" value="${schedule.timEnd}" /> >
                            <span class="input-group-addon"><i class="ti-alarm-clock"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">
                        参与人员
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="userNames" name="userNames" class="form-control" disabled
                               value="<c:forEach var="item" items="${schedule.participants}" varStatus="status">${item.name}<c:if test="${!status.last}">,</c:if></c:forEach>" >
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">是否公开<i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="isPublic" name="isPublic" class="form-control" value="${schedule.isPublic==1?"是":"否"}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">具体地点<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="address" name="address" class="form-control" value="${schedule.address}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">提交人</label>
                    <div class="col-md-4">
                        <p class="form-control-static">${schedule.creater.name}</p>
                    </div>
                    <label class="col-md-2 control-label">提交日期</label>
                    <div class="col-md-4">
                        <p class="form-control-static"><fmt:formatDate pattern="yyyy-MM-dd" value="${schedule.dateApply}" /></p>
                    </div>
                </div>
            </form>
            <!--===================================================-->
            <!-- END BASIC FORM ELEMENTS -->

            <div class="panel-footer">
                <c:if test="${user.id==schedule.creater.id && timStart.getTime()>(java.util.Date()).getTime()}">
                    <a class="btn btn-warning" key="ajax_schedule_cancel" href="javascript:void(0);"><i class="fa fa-lg fa-minus"></i> 日程取消 </a>
                    <a class="btn btn-warning" key="ajax_schedule_edit" href="javascript:void(0);"><i class="fa fa-lg fa-edit"></i> 日程修改 </a>
                </c:if>
            </div>
        </div>
    </div>
</div>

<script>

    $("a[key='ajax_schedule_cancel']").unbind("click").bind("click",function(){
        __confirm_dialog("提示：","确定要取消日程吗？",
            function () {
                var url = "<%=path%>/activiti/schedule/cancel/"+$("#keyId").val();
                __ajax_get(url, null, function (data) {
                    if (data.state == 1) {
                        // 关闭弹出的对话框
                        dialogModal.close();
                        // 刷新日程安排
                        $('#calendar').fullCalendar('refetchEvents');
                    }
                });
            }
        )
    });

    //编辑
    $("a[key='ajax_schedule_edit']").unbind("click").bind("click",function(){
        __confirm_dialog("提示：","确定要修改日程吗？",
            function () {
                // 关闭弹出的对话框
                dialogModal.close();
                // 加载编辑页面
                loadURL("<%=path%>/activiti/schedule/edit/"+$("#keyId").val(),$('#page-content'));
            }
        )
    });

    // 加载完成后执行
    $(function(){

    })

</script>




